from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import PaymentViewSet, WeChatPaymentNotifyViewSet

# 创建路由器并注册视图集
router = DefaultRouter()
router.register(r'', PaymentViewSet, basename='payment')

# 微信支付通知视图集
notify_router = DefaultRouter()
notify_router.register(r'', WeChatPaymentNotifyViewSet, basename='wechat-payment-notify')

urlpatterns = [
    path('<int:order_id>/', include(router.urls)),
    path('wechat/notify/', WeChatPaymentNotifyViewSet.as_view({'post': 'create'}), name='wechat_payment_notify'),
]